/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* 应用容器 */
.app-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

/* 登录面板 */
.login-panel {
    width: 100%;
    max-width: 400px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    padding: 40px;
    text-align: center;
}

.login-panel.hidden {
    display: none;
}

.login-box h2 {
    color: #4285f4;
    margin-bottom: 20px;
    font-size: 24px;
}

.login-box input {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border 0.3s;
}

.login-box input:focus {
    border-color: #4285f4;
    outline: none;
}

.login-box button {
    width: 100%;
    padding: 12px;
    background-color: #4285f4;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.login-box button:hover {
    background-color: #3367d6;
}

/* 主聊天界面 */
.main-chat {
    display: flex;
    width: 100%;
    max-width: 1200px;
    height: 80vh;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.main-chat.hidden {
    display: none;
}

/* 用户列表 */
.user-list {
    width: 300px;
    border-right: 1px solid #eee;
    display: flex;
    flex-direction: column;
}

.user-list .header {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.current-user-info {
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 10px;
    object-fit: cover;
}

.user-list-content {
    flex: 1;
    overflow-y: auto;
}

.user-list-items {
    padding: 10px;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.user-item:hover {
    background-color: #f5f5f5;
}

.user-item.has-new-message {
    background-color: #e8f0fe;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 500;
}

.user-id {
    font-size: 12px;
    color: #777;
}

.status {
    font-size: 24px;
    margin-left: 10px;
}

.status.online {
    color: #0f9d58;
}

.status.offline {
    color: #ccc;
}

.no-users {
    text-align: center;
    padding: 20px;
    color: #777;
}

/* 聊天区域 */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
}

.back-button {
    background: none;
    border: none;
    margin-right: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.back-button:hover {
    background-color: #f5f5f5;
}

.back-button.hidden {
    display: none;
}

.chat-partner-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.current-chat-title {
    font-size: 18px;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f9f9f9;
}

.default-chat-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #777;
}

.message {
    margin-bottom: 15px;
    max-width: 70%;
}

.message.sent {
    margin-left: auto;
    text-align: right;
}

.message.received {
    margin-right: auto;
}

.message-content {
    display: inline-block;
    padding: 10px 15px;
    border-radius: 18px;
    background-color: #e8f0fe;
    color: #333;
}

.message.sent .message-content {
    background-color: #4285f4;
    color: white;
}

.message-time {
    font-size: 12px;
    color: #777;
    margin-top: 5px;
}

.message.system {
    text-align: center;
    color: #777;
    font-size: 14px;
    margin: 10px 0;
}

.chat-input {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
}

.chat-input input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 16px;
    margin-right: 10px;
}

.chat-input input:focus {
    outline: none;
    border-color: #4285f4;
}

.chat-input button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #4285f4;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s;
}

.chat-input button:hover {
    background-color: #3367d6;
}

.chat-input.hidden {
    display: none;
}

/* 响应式布局 */
@media (max-width: 768px) {
    .app-container {
        padding: 0;
        height: 100vh;
    }
    
    .main-chat {
        height: 100vh;
        border-radius: 0;
    }
    
    .user-list {
        width: 100%;
    }
    
    .chat-area {
        display: none;
    }
    
    .chat-area.active {
        display: flex;
    }
    
    .user-list.active {
        display: flex;
    }
    
    .user-list:not(.active) {
        display: none;
    }
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.message {
    animation: fadeIn 0.3s ease-out;
}
.no-messages {
    text-align: center;
    padding: 20px;
    color: #777;
    font-size: 14px;
}

.user-item.has-new-message {
    background-color: #e8f0fe;
    position: relative;
}

.user-item.has-new-message::after {
    content: "";
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background-color: #4285f4;
    border-radius: 50%;
}

.status {
    font-size: 24px;
    margin-left: 10px;
}

.status.online {
    color: #0f9d58;
}

.status.offline {
    color: #ccc;
}

/* 系统消息样式 */
.message.system {
    text-align: center;
    color: #777;
    font-size: 14px;
    margin: 10px 0;
}